package com.yunwushanhe.document.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@MapperScan("com.yunwushanhe.document.mapper")
@Configuration
@EnableTransactionManagement //自动管理事务的注解，有了这个可以把扫描文件的操作放到这里，就不用放到MybatisPlusApplication这个文件里面了
public class MybatisPlusConfig {
    //注册乐观锁插件
    /*@Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return interceptor;
    }*/
}
